package org.siam.impl.data.formatting {
	
	import flash.utils.Dictionary;
	
	import org.siam.core.data.formatting.IFormatter;
	import org.siam.core.data.formatting.IFormatterRegistry;
	import org.siam.impl.data.formatting.formatters.DefaultFormatter;

	public class FormatterRegistry implements IFormatterRegistry {
		
		private var _registry:Dictionary = new Dictionary();
		
		public function FormatterRegistry() {
		}
		
		public function register(name:String, formatter:IFormatter):void {
			_registry[name] = formatter;			
		}
		
		public function find(name:String):IFormatter {
			return _registry.hasOwnProperty(name) 
					? _registry[name] : DefaultFormatter.INSTANCE;
		}
	}
}